
package com.shop.cloud.mall.api.controller;
import com.shop.cloud.common.core.util.R;
import com.shop.cloud.common.portal.annotation.ApiLogin;
import com.shop.cloud.mall.common.entity.OrderBill;
import com.shop.cloud.mall.api.service.OrderBillService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 订单发票
 *
 * @author
 * @date 2023-04-14 11:06:56
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/orderbill")
@Tag(description = "orderbill", name = "订单发票API")
public class OrderBillController {

    private final OrderBillService orderBillService;

    /**
     * 订单发票查询
     * @param id
     * @return R
     */
    @Operation(summary = "订单发票查询")
    @GetMapping("/{id}")
	@ApiLogin
    public R getById(@PathVariable("id") String id) {
        return R.ok(orderBillService.getById(id));
    }

    /**
     * 订单发票修改
     * @param orderBill 订单发票
     * @return R
     */
    @Operation(summary = "订单发票修改")
    @PutMapping
	@ApiLogin
    public R updateById(@RequestBody OrderBill orderBill) {
        return R.ok(orderBillService.updateById(orderBill));
    }

	/**
	 * 订单发票新增
	 * @param orderBill 订单发票
	 * @return R
	 */
	@Operation(summary = "订单发票新增")
	@PostMapping
	@ApiLogin
	public R save(@RequestBody OrderBill orderBill) {
		return R.ok(orderBillService.save(orderBill));
	}

}
